Fix booking time calculation for multi-day flex trip searches #7255
+171
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
As detailed in #7203, when a bookingTime parameter is provided in flex trip queries, the requestedBookingTime was calculated once relative to the search date's start-of-service, then reused for all FlexServiceDate objects across multiple days. This caused valid trips to be incorrectly filtered out when the booking time and trip departure were on different days.
Changed FlexServiceDate to store the original Instant and ZoneId, then calculate seconds-since-start-of-service on-demand relative to each date's own start-of-service. This ensures booking time comparisons use the correct reference point for each service date.
Issue
Closes #7203
Unit tests
Updated unit tests
Documentation
No